﻿Imports System.Web
Imports System.Web.UI.WebControls

Public Class UCFormWeb
    Public Sub LlenarListaObjetos(ByVal lst As ListControl, ByVal oBE() As Object)
        With lst
            .DataSource = oBE
            .DataTextField = "Nombre"
            .DataValueField = "Codigo"
            .DataBind()
        End With
    End Sub


    Public Sub LlenarListaObjetos(ByVal lst As ListControl, ByVal oBE() As Object, ByVal Codigo As String, ByVal Nombre As String)
        With lst
            .DataSource = oBE
            .DataTextField = Nombre
            .DataValueField = Codigo
            .DataBind()
        End With
    End Sub

    Public Sub BajarArchivo(ByVal tipoArchivo As String, ByVal archivoCliente As String, ByVal archivoServidor As String)
        With HttpContext.Current.Response
            .ContentType = "Application/" & tipoArchivo
            .AppendHeader("content-disposition", "attachment; filename=" & archivoCliente)
            .TransmitFile(archivoServidor)
            .Flush()
            .Close()
        End With
    End Sub

    Public Sub LimpiarCache()
        With HttpContext.Current.Response.Cache
            .SetCacheability(HttpCacheability.NoCache)
            .SetNoStore()
            .SetExpires(DateTime.Now().Subtract(New TimeSpan(1, 0, 0)))
            .SetLastModified(DateTime.Now)
            .SetAllowResponseInBrowserHistory(False)
        End With
    End Sub

End Class
